#define MAXRECORDCOUN	0x5000
#define ERROR_RECORD_FULL 99
#define ERROR_RECORD_FILE_OPEN	98
#define ERROR_RECORD_FILE_SEEK	97

typedef union
{
	unsigned long i;
	unsigned char ch[4];
} IC;
//CARD STURCT//////////////////////////////////////////////////////////////
typedef struct
{
	unsigned char SysCard;
	unsigned char LTDSnr[5];
	unsigned char CardType;
	unsigned char UseScr;
	unsigned char SysPWD[6];
	unsigned char Version;
	unsigned char CRC;	
}TSysCardInfo;
typedef struct
{
	unsigned char SysPWD[6];
	unsigned char UseScr;
	unsigned char CardType;
	unsigned char BackByte[7];
	unsigned char CRC;	
}TSysCardData;
typedef struct
{
	unsigned char CardSnr[3];
	unsigned char CardType;
	unsigned char DayMaxTimes;
	unsigned char DayMaxUse;
	unsigned char MonMaxTimes;
	unsigned char MonMaxUse[2];
	unsigned char WorkMode;
	unsigned char UserSnr[5];
	unsigned char CRC;	
}TUserCardInfo;
typedef struct 
{
	unsigned short Money;
	unsigned char Empty;
	unsigned char MonTotalUse[2];
	unsigned char MonTotalTimes;
	unsigned char UseDate[3];
	unsigned char UseTime[2];
	unsigned char DayTotalUse[2];
	unsigned char DayTotalTimes;
	unsigned char BackByte;
	unsigned char CRC;	
}TUserCardData;

//SYSTEM PAR///////////////////////////////////////////////////////////////
typedef struct 
{
	unsigned long PosAddr;
	unsigned long Password;
	unsigned char ShopSnr[16];
	unsigned char ShopName[32];
	unsigned char ServerURL[128];
	TSysCardInfo SysCardInfo;
	TSysCardData SysCardData;
}TSysPar;

typedef struct 
{	
	unsigned long RecordSnr;
	unsigned long CurrentlySnr;
	unsigned long CommSnr;
	unsigned long CRC;
}TRP;

typedef struct 
{
	unsigned long PosAddr;
	unsigned long CardSnr;
	unsigned long UserID;
	unsigned char UserSnr[8];
	unsigned long CardMoney;
	unsigned long Money;
	unsigned long Balance;
	unsigned char Datetime[20];
}TRC;





extern TSysPar SP;
extern TRP RP;
extern char SysVersion[];
